﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YWTSSys.DAL;
using YWTSSys.Model;
using YWTSSys.Library;
using System.Data;
namespace YWTSSys.BLL
{
    public  class TelRecordController
    {
        /// <summary>
        /// 添加通话记录
        ///如果@回访电话记录ID大于0，表示此条为回访记录
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static int Add(TelRecordInfo obj, int 需回访天数)
        {
            return TelRecordDAL.Add(obj, 需回访天数);
        }
        /// <summary>
        /// 根据客户ID，获取最近20条记录
        /// </summary>
        /// <param name="客户ID"></param>
        /// <returns></returns>
        public static IDataReader GetByCustomerIDTop20(int 客户ID)
        {
            return TelRecordDAL.GetByCustomerIDTop20(客户ID);
        }
        /// <summary>
        /// 根据客户ID，获取通话明细
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static TelRecordInfo GetByID(int ID)
        {
            return CBO.FillObject<TelRecordInfo>( TelRecordDAL.GetByID(ID));
        }
        /// <summary>
        /// 获取通话列表。返回中包括客户信息
        /// </summary>
        /// <param name="WhereSql"></param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="Sort"></param>
        /// <param name="TotalCount"></param>
        /// <returns></returns>
        public static DataTable GetPagination(string WhereSql, int PageIndex, int PageSize, string Sort, ref int TotalCount)
        {
            return TelRecordDAL.GetPagination(WhereSql, PageIndex, PageSize, Sort, ref  TotalCount);
        }

        /// <summary>
        /// 业务员获取其需回访的电话记录
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public static DataTable GetMyNeedBackTel(int UserId)
        {
            return TelRecordDAL.GetMyNeedBackTel(UserId);

        }
    }
}
